package com.dingyuhang.bean;

import com.dingyuhang.enums.TopicType;

import java.io.Serializable;
import java.util.Date;
import java.util.List;


/**
 * 帖子
 */
public class Topic implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = -8038895636713325306L;
	/**
	 * 主键
	 */
	private Integer id;
	/**
	 * 标题
	 */
	private String title;
	

	/**
	 * 发布者 user_id
	 */
	private User user;
	
	
	/**
	 * 所属板块 forum_id
	 */
	private Forum forum;
	/**
	 * 枚举的帖子类型（普通 ，精华，公告，置顶）
	 */
	private TopicType type;
	
	/**
	 * 帖子的发布时间
	 */
	private Date postTime;
	/**
	 * 帖子最后回复时间
	 */
	private Date replyTime;
	
	/**
	 * 帖子楼层
	 */
	private Integer floors;
	
	/**
	 * 帖子内容
	 */
	private String content;
	
	
	/**
	 * 贴的的回复
	 */
	private List<Reply> replys;
	
	
	
	public void setContent(String content) {
		this.content = content;
	}
	
	public String getContent() {
		return content;
	}

	public List<Reply> getReplys() {
		return replys;
	}

	public void setReplys(List<Reply> replys) {
		this.replys = replys;
	}

	public void setReplyTime(Date replyTime) {
		this.replyTime = replyTime;
	}

	public Topic() {
		super();
		// TODO Auto-generated constructor stub
	}

	public Topic(Integer id, String title, User user, Forum forum, TopicType type, Date postTime, Date replyTime,
			Integer floors) {
		super();
		this.id = id;
		this.title = title;
		this.user = user;
		this.forum = forum;
		this.type = type;
		this.postTime = postTime;
		this.replyTime = replyTime;
		this.floors = floors;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public Forum getForum() {
		return forum;
	}

	public void setForum(Forum forum) {
		this.forum = forum;
	}

	public TopicType getType() {
		return type;
	}

	public void setType(TopicType type) {
		this.type = type;
	}

	public Date getPostTime() {
		return postTime;
	}

	public void setPostTime(Date postTime) {
		this.postTime = postTime;
	}

	public Date getReplyTime() {
		return replyTime;
	}

	public void setLastReplyTime(Date replyTime) {
		this.replyTime = replyTime;
	}

	public Integer getFloors() {
		return floors;
	}

	public void setFloors(Integer floors) {
		this.floors = floors;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Topic other = (Topic) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "Topic [id=" + id + ", title=" + title + ", user=" + user + ", forum=" + forum + ", type=" + type
				+ ", postTime=" + postTime + ", replyTime=" + replyTime + ", floors=" + floors + "]";
	}
	
}
